package org.icsdt.sp;

import org.icsdt.sp.fragments.FragmentLista;
import org.icsdt.sp.service.GCMHelper;

import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.app.ActionBar.TabListener;
import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

public class SISCODActivity extends Activity implements TabListener {

    private final BroadcastReceiver mensagemReceiver = new BroadcastReceiver() {
	@Override
	public void onReceive(Context context, Intent intent) {

	    //startTransacao(FragmentListaSPS.this);
	}
    };

    @Override
    public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.tela_principal);
	/*ActionBar actionBar = getActionBar();
	actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
	actionBar.setDisplayHomeAsUpEnabled(true);
	Tab tab = actionBar.newTab();
	tab.setText(R.string.menu_todos);
	tab.setTabListener(this);
	Tab tab1 = actionBar.newTab();
	tab1.setText(R.string.menu_local);
	tab1.setTabListener(this);
	Tab tab2 = actionBar.newTab();
	tab2.setText(R.string.menu_patio);
	tab2.setTabListener(this);
	Tab tab3 = actionBar.newTab();
	tab3.setText(R.string.menu_vistoria);
	tab3.setTabListener(this);
	actionBar.addTab(tab,0,true);
	actionBar.addTab(tab1,1);
	actionBar.addTab(tab2,2);
	actionBar.addTab(tab3,3);
	registerReceiver(mensagemReceiver, new IntentFilter("RECEIVER_ACTIVITY"));*/
    }


    private Context getContext() {
	return getApplicationContext();
    }

   

    @Override
    public void onDestroy() {
	GCMHelper.onDestroy();
	unregisterReceiver(mensagemReceiver);
	super.onDestroy();
    }


    public void onTabSelected (Tab tab, FragmentTransaction ft){
	/*FragmentManager fm = getFragmentManager();
	FragmentLista frag1 = (FragmentLista) fm.findFragmentById(R.id.frag1);
	switch (tab.getPosition()) {
	case 0:
	    frag1.setTipo("");
	    break;
	case 1:
	    frag1.setTipo("LOCAL");
	    break;
	case 2:
	    frag1.setTipo("VEICULO");
	    break;

	}
	frag1.atualizarView();*/

    }

    public void onTabUnselected (Tab tab, FragmentTransaction ft){

    }
    public void onTabReselected (Tab tab, FragmentTransaction ft){


    }
  
   
}
